<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>配置设置 - 七牛存储在线管理系统</title>
    <link rel="stylesheet" href="/static/css/layui.css">
    <style>
        .content {
            margin: 30px 0 0 0;
        }
        .layui-form-item .layui-input-inline{
            width:400px;
        }
    </style>
</head>
<?php include 'nav.php'; ?>
<div class="layui-body">
    <!-- 内容主体区域 -->
    <div style="padding: 15px;">
        <div class="position">
			<span class="layui-breadcrumb">
				<a href="/">首页</a>
				<a><cite>配置设置</cite></a>
			</span>
        </div>
        <div class="content">
            <form class="layui-form">
                <div class="layui-form-item">
                    <label class="layui-form-label">AccessKey</label>
                    <div class="layui-input-inline">
                        <input type="text" name="ak" value="<?php echo $ak; ?>" required lay-verify="required"
                               placeholder="请输入 AccessKey" autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux">ak 秘钥</div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">SecretKey</label>
                    <div class="layui-input-inline">
                        <input type="text" name="sk" value="<?php echo $sk; ?>" required lay-verify="required"
                               placeholder="请输入 SecretKey" autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux">sk 秘钥</div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">Bucket</label>
                    <div class="layui-input-inline">
                        <input type="text" name="bucket" value="<?php echo $bucket; ?>" required lay-verify="required"
                               placeholder="请输入 Bucket" autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux">存储空间名称</div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">Domain</label>
                    <div class="layui-input-inline">
                        <input type="text" name="domain" value="<?php echo $domain; ?>" required lay-verify="required"
                               placeholder="请输入 Domain" autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux">绑定域名</div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
                        <a href="https://www.shenlin.ink/back/65.html" title="如何获取七牛云存储的AccessKey和SecretKey"
                           target="_blank" class="layui-btn layui-btn-primary">如何设置？</a>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<div class="layui-footer">
    <!-- 底部固定区域 -->
    © Online-gallery系统
</div>
</div>
<script src="/static/layui.js"></script>
<script>
    //JavaScript代码区域
    layui.use(['element', 'form', 'jquery'], function () {
        var form = layui.form, $ = layui.jquery
        form.on('submit(*)', function (data) {
            $.ajax({
                data: data.field,
                url: '/index.php/system/data.html',
                dataType: 'json',
                async: false,
                type: 'post',
                success: function (res) {
                    if (res.code === 200) {
                        layer.msg(res.msg, {}, function () {
                            window.location.reload();
                        });
                    } else {
                        layer.msg(res.msg);
                    }
                },
                error: function () {
                    layer.msg("接口错误");
                }
            });
            return false;
        });
    });
</script>
</body>
</html>
